package com.github.jcooky.structure;

public class ArrayListDeque implements Deque {
	private ArrayList al;

	public ArrayListDeque(ArrayList al) {
		this.al = al;
	}
	
	public void addFirst(Object o) {
		al.add(0, o);
	}

	public void addLast(Object o) {
		al.add(size(), o);
	}

	public Object removeFirst() {
		return al.remove(0);
	}

	public Object removeLast() {
		return al.remove(size() - 1);
	}

	public Object getFirst() {
		return al.get(0);
	}

	public Object getLast() {
		return al.get(size() - 1);
	}

	public int size() {
		return al.size();
	}

	public boolean isEmpty() {
		return al.isEmpty();
	}
	
	public Iterator iterator() {
		return al.iterator();
	}
}
